<template>
  <div class="container">
    <div class="my-header">
      <div class="user-info">
        <div class="head-sculpture">
          <img src="../img/headSculpture.png" alt="">
        </div>
        <div class="username">{{this.loginToken.username}}</div>
        <div class="account-set" @click="goToSet()">
          <img src="../img/set.png" alt="">
        </div>
      </div>
      <div class="xlist-group">
        <div class="assets-item" v-for="(item, index) in headerList" :key="index">
          <div class="assets-item-value">1</div>
          <span class="assets-item-key">{{item}}</span>
        </div>
      </div>
    </div>
    <div class="my-order">
      <div class="my-order-header">
        <span class="my-order-header-title">我的订单</span>
        <span class="my-order-header-checkAll" @click="goToMyOrder">查看全部订单></span>
      </div>
      <div class="my-order-body">
        <div class="my-order-body-info" v-for="(item, index) in bodyInfo1" :key="index">
          <div class="my-od-bd-box" @click="goToGuid(index + 1)">
            <div class="my-order-body-img">
              <img :src="item.url">
            </div>
            <span class="body-info">{{item.value}}</span>
          </div>
        </div>
        <div class="my-order-body-info" v-for="item in bodyInfo2" :key="item.value">
          <div class="my-od-bd-box">
            <div class="my-order-body-img">
              <img :src="item.url">
            </div>
            <span class="body-info">{{item.value}}</span>
          </div>
        </div>
      </div>
    </div>
    <div class="my-tools">
      <div class="my-tools-header">
        <span class="my-tools-header-title">必备工具</span>
        <span class="my-tools-header-checkAll">查看全部工具></span>
      </div>
      <div class="my-tools-body">
        <div class="my-tools-items" v-for="(item, index) in toolsList" :key="index">
          <div class="my-tools-body-img">
            <img :src="item.url">
          </div>
          <span class="my-tools-items-value">{{item.value}}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import {
    mapState
  } from 'vuex'
  export default {
    data() {
      return {
        headerList: ['店铺收藏', '商品收藏', '我的足迹', '红包卡券'],
        bodyInfo1: [{
            value: '待付款',
            url: require('../img/PendingPayment.png')
          },
          // {
          //   value: '待发货',
          //   url: require('../img/TobeShipped.png')
          // },
          {
            value: '待收货',
            url: require('../img/ToBeRecived.png')
          }
        ],
        bodyInfo2: [{
            value: '评价',
            url: require('../img/comment.png')
          },
          {
            value: '退款/售后',
            url: require('../img/Refund-AfterSales.png')
          }
        ],
        toolsList: [{
            value: '每日返现',
            url: require('../img/CashBack.png')
          },
          {
            value: '领券中心',
            url: require('../img/CollectCoupons.png')
          },
          {
            value: '闲置换钱',
            url: require('../img/IdleMmoney.png')
          },
          {
            value: '客服小蜜',
            url: require('../img/customerService.png')
          },
          {
            value: '花呗',
            url: require('../img/AntCreditPay.png')
          },
          {
            value: '我的快递',
            url: require('../img/express.png')
          },
          {
            value: '我的评价',
            url: require('../img/myComment.png')
          },
          {
            value: '主题换肤',
            url: require('../img/skin.png')
          }
        ]
      }
    },
    methods: {
      goToSet() {
        this.$router.push({
          name: 'Set'
        })
      },
      goToMyOrder() {
        this.$router.push({
          name: 'MyOrder'
        })
      },
      // 锚点跳转
      goToGuid(id) {
        this.$router.push({
          path: '/MyOrder',
          query: {
            name: id
          }
        })
      }
    },
    computed: {
      ...mapState(['loginToken'])
    }
  }
</script>

<style scoped>
  .container {
    background-color: #F2F2F2;
    height: 736px;
  }

  .my-header {
    background-color: #ef600a;
    height: 200px;
    width: 100%;
  }

  .head-sculpture {
    width: 50px;
    text-align: center;
  }

  .username {
    color: #F2F2F2;
    width: 75px;
    text-align: center;
  }

  .user-info {
    display: flex;
    padding-top: 40px;
    padding-left: 30px;
  }

  .account-set {
    width: 240px;
    text-align: right;
  }

  .account-set img {
    width: 22px;
    height: 22px;
  }

  .xlist-group {
    display: flex;
    height: 67px;
    justify-content: space-around;
    padding-top: 25px;
    color: white;
    font-size: 13px;
  }

  .assets-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .assets-item-value {
    text-align: center;
    width: 100%;
  }

  .assets-item-key {
    text-align: center;
    width: 100%;
  }

  .my-order {
    margin: 18px 18px;
    background-color: white;
    border-radius: 8px;
  }

  .my-tools {
    margin: 18px 18px;
    background-color: white;
    border-radius: 8px;
  }

  .my-order-header,
  .my-tools-header {
    position: relative;
    display: flex;
    height: 41px;
    width: 100%;
    align-items: center;
    border-bottom: 1px solid #DDDDDD;
  }

  .my-order-header .my-order-header-title,
  .my-tools-header-title {
    margin-left: 8px;
    font-size: 15px;
    font-weight: bold;
  }

  .my-order-header .my-order-header-checkAll,
  .my-tools-header-checkAll {
    position: absolute;
    font-size: 13px;
    font-weight: 300;
    right: 10px;
  }

  .my-order-body {
    display: flex;
    justify-content: space-around;
    height: 83px;
    align-items: center;
  }

  .my-tools-body {
    display: flex;
    justify-content: space-around;
    height: 150px;
    align-items: center;
  }

  .my-order-body-info {
    display: flex;
    flex-wrap: wrap;
    text-align: center;
  }

  .my-tools-items {
    display: flex;
    flex-wrap: wrap;
    text-align: center;
    flex: 0 0 25%;
  }

  .my-order-body .my-order-body-img,
  .my-tools-body .my-tools-body-img {
    width: 100%;
  }

  .my-order-body .my-order-body-img img,
  .my-tools-body .my-tools-body-img img {
    width: 28px;
    height: 28px;
  }

  .my-order-body .body-info,
  .my-tools-body .my-tools-items-value {
    color: #666666;
    font-size: 13px;
    width: 100%;
  }

  .my-tools-body {
    display: flex;
    flex-wrap: wrap;
  }
</style>
